﻿--|--------------------------------------------------------------------------------
--| [GetEntityByID] - Insert Procedure Script for Entity
--|--------------------------------------------------------------------------------
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id (N'[dbo].[GetEntityByID]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) 
  DROP PROCEDURE [dbo].[GetEntityByID]
GO

CREATE PROCEDURE [dbo].[GetEntityByID]
(
	@ID int
)
AS
	SET NOCOUNT ON

	SELECT
		E.[ID],
		E.[Name],
		E.[Description],
		E.[TeamID],
		E.[EntityTypeID],
		ET.[Name],
		E.[Photo]
	FROM 
	[Entity] E JOIN [EntityType] ET ON ET.ID = E.[EntityTypeID]
	WHERE
		E.[ID] = @ID
	
GO
 